//
// Created by 吴喆 on 2020/3/15.
//

#import "World.h"


World::World(float gravityValue) {

    b2Vec2 gravity(0.0f, -gravityValue);

    b2world = new b2World(gravity);
}

World::~World() {
    delete b2world;
}

void World::step() {
    b2world->Step(CTime::getInstance()->getDelta(), velocityIterations, positionIterations);
}

b2Body *World::createBody(b2BodyDef *def) {
    return b2world->CreateBody(def);
}
